package com.wang.learn.common.builder;

import com.wang.learn.common.domain.Specification;
import lombok.RequiredArgsConstructor;

/**
 * @author : wcz
 * @version V1.0
 * @Description: 逻辑与规则
 */
@RequiredArgsConstructor
class AndSpecification<T> implements Specification<T>{

  private final Specification<T> spec1;
  private final Specification<T> spec2;

  @Override
  public boolean isSatisfiedBy(T t) {
    return spec1.isSatisfiedBy(t) && spec2.isSatisfiedBy(t);
  }
}
